package com.hujia.hjsurprisemeal.repository;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hujia.hjsurprisemeal.model.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserMapper extends BaseMapper<User> {
    // 确保user_id逐一增加
    @Options(useGeneratedKeys = true, keyProperty = "userId")
    @Select("SELECT * FROM user")

    public List<User> getAllUsers();
    @Select("SELECT * FROM user WHERE name = #{username}")
    User selectByUsername(@Param("username") String username);
}